package com.example;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class Game extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_game);
		
		final Button menu_button=(Button) findViewById(R.id.back_to_menu_button);
		menu_button.setVisibility(View.INVISIBLE);
		menu_button.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				returnToMenu();
			}
		});
		
		Button pause_button = (Button) findViewById(R.id.pause_button);
		pause_button.setOnClickListener(new View.OnClickListener() {
			boolean pausa=false;
			@Override
			public void onClick(View v) {
				if(!pausa){
					menu_button.setVisibility(View.VISIBLE);
					onPause();
					Log.i("Game","gioco in pausa");
					pausa=true;
				}
				else{
					onResume();
					Log.i("Game","gioco ripreso");
					pausa=false;
				}
			}
		});
	}//onCreate
	
	private void returnToMenu() {
		finish();
		finish();
		Intent intent=new Intent(this,MainMenu.class);
		startActivity(intent);
	}
	
}




